<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMemberLevelsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('member_levels', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->integer('store_id')->index()->nullable()->comment('门店ID');
            $table->string('name',190)->index()->nullable()->comment('会员等级名称');
            $table->integer('is_auto_upgrade')->index()->default(1)->comment('1.不自动升级、2.自动升级');
            $table->integer('is_opening')->index()->default(1)->comment('1.不可开通、2.可开通');
            $table->integer('amount')->index()->default(0)->comment('开通会员所需的充值金额');
            $table->integer('give_amount')->index()->default(0)->comment('开通会员赠送金额');
            $table->integer('discount')->index()->default(0)->comment('会员折扣');
            $table->text('description')->nullable()->comment('描述');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('member_levels');
    }
}
